<?php

class Application_Form_AdminEdit extends Zend_Form
{

    public function init()
    {
        // Set the method for the display form to POST
        $this->setMethod('post');

        $this->addElement('text', 'ime', array(
            'label'      => 'Ime',
            'required'   => true,
            'class'      => 'form-control'
        ));

        $this->addElement('text', 'priimek', array(
            'label'      => 'Priimek',
            'required'   => true,
            'class'      => 'form-control'
        ));

        $this->addElement('password', 'geslo', array(
            'label'      => 'Staro geslo',
            'required'   => true,
            'class'      => 'form-control'
        ));

        $this->addElement('checkbox', 'spremeni_geslo', array(
            'label'    => 'Spremeni geslo?',
            'required' => false,
            'class'      => 'form-control'
        ));

        $this->addElement('password', 'geslo_novo', array(
            'label'      => 'Novo geslo',
            'required'   => false,
            'class'      => 'form-control'
        ));

        $this->addElement('password', 'geslo_potrditev', array(
            'label'      => 'Potrditev gesla',
            'required'   => false,
            'class'      => 'form-control'
        ));

        $this->addElement('submit', 'submit', array(
            'label'    => 'Save',
            'class'      => 'form-control'
        ));

        $adminSession = new Zend_Session_Namespace('Store_Admin');
        $adminModel = new Application_Model_AdminUser();
        $adminMapper = new Application_Model_AdminUserMapper();
        $adminMapper->find($adminSession->adminId, $adminModel);

        $data = array("ime" => $adminModel->getIme(), "priimek" => $adminModel->getPriimek());

        $this->setDefaults($data);

        $this->setAttrib('class', 'form-group');
        $this->setAttrib('id', 'admin-edit-form');
    }


}

